Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: test more features with Miri #5317

Closed
wants to merge 24 commits into from
Closed

chore: test more features with Miri #5317

wants to merge 24 commits into from

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Dec 27, 2022

Motivation

It seems Miri recently added support for epoll_create1: rust-lang/miri#2357

Reported errors

SB violations

--lib -- runtime::time::tests::poll_process_levels (tokio/src/runtime/time/tests/mod.rs:211:26, SB violation)
error: Undefined Behavior: trying to retag from <6548693> for SharedReadWrite permission at alloc2623231[0x0], but that tag does not exist in the borrow stack for this location
   --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:385:18
    |
385 |         unsafe { &*self.as_ptr() }
    |                  ^^^^^^^^^^^^^^^
    |                  |
    |                  trying to retag from <6548693> for SharedReadWrite permission at alloc2623231[0x0], but that tag does not exist in the borrow stack for this location
    |                  this error occurs as part of retag at alloc2623231[0x0..0x10]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <6548693> was created by a SharedReadWrite retag at offsets [0x0..0x20]
   --> tokio/src/runtime/time/entry.rs:419:20
    |
419 |             inner: NonNull::from(self),
    |                    ^^^^^^^^^^^^^^^^^^^
help: <6548693> was later invalidated at offsets [0x0..0x200] by a Unique retag
   --> tokio/src/runtime/time/tests/mod.rs:227:22
    |
227 |         entries.push(entry);
    |                      ^^^^^
    = note: BACKTRACE (of the first span):
    = note: inside `std::ptr::NonNull::<util::linked_list::Pointers<runtime::time::entry::TimerShared>>::as_ref::<'_>` at /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:385:18: 385:33
note: inside `util::linked_list::LinkedList::<runtime::time::entry::TimerShared, <runtime::time::entry::TimerShared as util::linked_list::Link>::Target>::pop_back`
   --> tokio/src/util/linked_list.rs:152:25
    |
152 |             self.tail = L::pointers(last).as_ref().get_prev();
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `runtime::time::wheel::Wheel::process_expiration`
   --> tokio/src/runtime/time/wheel/mod.rs:244:32
    |
244 |         while let Some(item) = entries.pop_back() {
    |                                ^^^^^^^^^^^^^^^^^^
note: inside `runtime::time::wheel::Wheel::poll`
   --> tokio/src/runtime/time/wheel/mod.rs:163:21
    |
163 |                     self.process_expiration(expiration);
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `runtime::time::<impl runtime::time::handle::Handle>::process_at_time`
   --> tokio/src/runtime/time/mod.rs:[273](https://github.com/tokio-rs/tokio/actions/runs/3789042247/jobs/6442417285#step:6:274):33
    |
273 |         while let Some(entry) = lock.wheel.poll(now) {
    |                                 ^^^^^^^^^^^^^^^^^^^^
note: inside `runtime::time::tests::poll_process_levels`
   --> tokio/src/runtime/time/tests/mod.rs:231:9
    |
231 |         handle.inner.driver().time().process_at_time(t as u64);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/src/runtime/time/tests/mod.rs:211:26
    |
209 | #[test]
    | ------- in this procedural macro expansion
210 | #[cfg(not(loom))]
211 | fn poll_process_levels() {
    |                          ^
    = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to previous error

error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully: `/home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/bin/cargo-miri runner /home/runner/work/tokio/tokio/target/miri/x86_64-unknown-linux-gnu/debug/deps/tokio-e894b5abc4d6b773` (exit status: 1)
--test sync_barrier -- lots (tokio/tests/sync_barrier.rs:73:11, SB violation)
error: Undefined Behavior: trying to retag from <234728> for SharedReadWrite permission at alloc95758[0x28], but that tag does not exist in the borrow stack for this location
   --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:436:18
    |
436 |         unsafe { &mut *self.as_ptr() }
    |                  ^^^^^^^^^^^^^^^^^^^
    |                  |
    |                  trying to retag from <234728> for SharedReadWrite permission at alloc95758[0x28], but that tag does not exist in the borrow stack for this location
    |                  this error occurs as part of retag at alloc95758[0x28..0x38]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <234728> was created by a SharedReadWrite retag at offsets [0x28..0x50]
   --> /home/runner/work/tokio/tokio/tokio/src/sync/notify.rs:842:72
    |
842 |                     waiters.push_front(unsafe { NonNull::new_unchecked(waiter.get()) });
    |                                                                        ^^^^^^^^^^^^
help: <234728> was later invalidated at offsets [0x0..0x90] by a Unique retag
   --> tokio/tests/sync_barrier.rs:81:23
    |
81  |             wait.push(w);
    |                       ^
    = note: BACKTRACE (of the first span):
    = note: inside `std::ptr::NonNull::<tokio::util::linked_list::Pointers<tokio::sync::notify::Waiter>>::as_mut::<'_>` at /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:436:18: 436:37
note: inside `tokio::util::linked_list::LinkedList::<tokio::sync::notify::Waiter, <tokio::sync::notify::Waiter as tokio::util::linked_list::Link>::Target>::push_front`
   --> /home/runner/work/tokio/tokio/tokio/src/util/linked_list.rs:136:17
    |
136 |                 L::pointers(head).as_mut().set_prev(Some(ptr));
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::sync::futures::Notified::<'_>::poll_notified`
   --> /home/runner/work/tokio/tokio/tokio/src/sync/notify.rs:842:21
    |
842 |                     waiters.push_front(unsafe { NonNull::new_unchecked(waiter.get()) });
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `<tokio::sync::futures::Notified<'_> as std::future::Future>::poll`
   --> /home/runner/work/tokio/tokio/tokio/src/sync/notify.rs:900:9
    |
900 |         self.poll_notified(Some(cx.waker()))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio/src/sync/watch.rs:537:21
    |
537 |             notified.await;
    |                     ^^^^^^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio/src/sync/barrier.rs:181:35
    |
181 |             let _ = wait.changed().await;
    |                                   ^^^^^^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio/src/sync/barrier.rs:132:36
    |
132 |         return self.wait_internal().await;
    |                                    ^^^^^^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio-test/src/task.rs:125:30
    |
125 |         self.task.enter(|cx| fut.poll(cx))
    |                              ^^^^^^^^^^^^
note: inside `tokio_test::task::MockTask::enter::<[closure@tokio_test::task::Spawn<[async fn body@tokio::sync::Barrier::wait::{closure#0}]>::poll::{closure#0}], std::task::Poll<tokio::sync::BarrierWaitResult>>`
   --> /home/runner/work/tokio/tokio/tokio-test/src/task.rs:174:9
    |
174 |         f(&mut cx)
    |         ^^^^^^^^^^
note: inside `tokio_test::task::Spawn::<[async fn body@tokio::sync::Barrier::wait::{closure#0}]>::poll`
   --> /home/runner/work/tokio/tokio/tokio-test/src/task.rs:125:9
    |
125 |         self.task.enter(|cx| fut.poll(cx))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `lots`
   --> tokio/tests/sync_barrier.rs:80:29
    |
80  |             assert_pending!(w.poll());
    |                             ^^^^^^^^
note: inside closure
   --> tokio/tests/sync_barrier.rs:73:11
    |
72  | #[test]
    | ------- in this procedural macro expansion
73  | fn lots() {
    |           ^
    = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to previous error

error: test failed, to rerun pass `--test sync_barrier`

Caused by:
  process didn't exit successfully: `/home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/bin/cargo-miri runner /home/runner/work/tokio/tokio/target/miri/x86_64-unknown-linux-gnu/debug/deps/sync_barrier-c28f7d5935088139` (exit status: 1)
--test sync_mpsc_weak -- actor_weak_sender (tokio/tests/sync_mpsc_weak.rs:59:30, SB violation)
error: Undefined Behavior: trying to retag from <269941> for SharedReadWrite permission at alloc113145[0x12c], but that tag does not exist in the borrow stack for this location
   --> tokio/tests/sync_mpsc_weak.rs:117:17
    |
117 |                 self.handle_message(msg);
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^
    |                 |
    |                 trying to retag from <269941> for SharedReadWrite permission at alloc113145[0x12c], but that tag does not exist in the borrow stack for this location
    |                 this error occurs as part of two-phase retag at alloc113145[0x118..0x130]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <269941> was created by a Unique retag at offsets [0x118..0x130]
   --> tokio/tests/sync_mpsc_weak.rs:157:61
    |
157 |     let actor_handle = tokio::spawn(async move { actor.run().await });
    |                                                             ^^^^^^
help: <269941> was later invalidated at offsets [0x12c..0x12d] by a read access
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/core.rs:214:36
    |
214 |                 let future = match unsafe { &mut *ptr } {
    |                                    ^^^^^^^^^^^^^^^^^^^^
    = note: BACKTRACE (of the first span):
    = note: inside closure at tokio/tests/sync_mpsc_weak.rs:117:17: 117:41
note: inside closure
   --> tokio/tests/sync_mpsc_weak.rs:157:61
    |
157 |     let actor_handle = tokio::spawn(async move { actor.run().await });
    |                                                             ^^^^^^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/core.rs:223:17
    |
223 |                 future.poll(&mut cx)
    |                 ^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::loom::std::unsafe_cell::UnsafeCell::<tokio::runtime::task::core::Stage<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69]>>::with_mut::<std::task::Poll<()>, [closure@tokio::runtime::task::core::Core<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>::poll::{closure#0}]>`
   --> /home/runner/work/tokio/tokio/tokio/src/loom/std/unsafe_cell.rs:14:9
    |
14  |         f(self.0.get())
    |         ^^^^^^^^^^^^^^^
note: inside `tokio::runtime::task::core::Core::<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>::poll`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/core.rs:212:13
    |
212 | /             self.stage.stage.with_mut(|ptr| {
213 | |                 // Safety: The caller ensures mutual exclusion to the field.
214 | |                 let future = match unsafe { &mut *ptr } {
215 | |                     Stage::Running(future) => future,
...   |
223 | |                 future.poll(&mut cx)
224 | |             })
    | |______________^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/harness.rs:476:19
    |
476 |         let res = guard.core.poll(cx);
    |                   ^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::panic::AssertUnwindSafe<[closure@tokio::runtime::task::harness::poll_future<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>::{closure#0}]> as std::ops::FnOnce<()>>::call_once` at /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:271:9: 271:19
    = note: inside `std::panicking::r#try::do_call::<std::panic::AssertUnwindSafe<[closure@tokio::runtime::task::harness::poll_future<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>::{closure#0}]>, std::task::Poll<()>>` at /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:483:40: 483:43
    = note: inside `std::panicking::r#try::<std::task::Poll<()>, std::panic::AssertUnwindSafe<[closure@tokio::runtime::task::harness::poll_future<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>::{closure#0}]>>` at /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:447:19: 447:81
    = note: inside `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<[closure@tokio::runtime::task::harness::poll_future<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>::{closure#0}]>, std::task::Poll<()>>` at /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:137:14: 137:33
note: inside `tokio::runtime::task::harness::poll_future::<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/harness.rs:464:18
    |
464 |       let output = panic::catch_unwind(panic::AssertUnwindSafe(|| {
    |  __________________^
465 | |         struct Guard<'a, T: Future, S: Schedule> {
466 | |             core: &'a Core<T, S>,
467 | |         }
...   |
478 | |         res
479 | |     }));
    | |_______^
note: inside `tokio::runtime::task::harness::Harness::<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>::poll_inner`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/harness.rs:198:27
    |
198 |                 let res = poll_future(self.core(), cx);
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::task::harness::Harness::<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>::poll`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/harness.rs:152:15
    |
152 |         match self.poll_inner() {
    |               ^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::task::raw::poll::<[async block@tokio/tests/sync_mpsc_weak.rs:157:37: 157:69], std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/raw.rs:255:5
    |
255 |     harness.poll();
    |     ^^^^^^^^^^^^^^
note: inside `tokio::runtime::task::raw::RawTask::poll`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/raw.rs:200:18
    |
200 |         unsafe { (vtable.poll)(self.ptr) }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::task::LocalNotified::<std::sync::Arc<tokio::runtime::scheduler::current_thread::Handle>>::run`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/task/mod.rs:459:9
    |
459 |         raw.poll();
    |         ^^^^^^^^^^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/scheduler/current_thread.rs:584:25
    |
584 |                         task.run();
    |                         ^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<(), [closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#3}]>`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/coop.rs:102:5
    |
102 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<(), [closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#3}]>`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/coop.rs:68:5
    |
68  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/scheduler/current_thread.rs:285:29
    |
285 |         self.enter(core, || crate::runtime::coop::budget(f))
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<(), [closure@tokio::runtime::scheduler::current_thread::Context::run_task<(), [closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#3}]>::{closure#0}]>`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/scheduler/current_thread.rs:350:19
    |
350 |         let ret = f();
    |                   ^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::run_task::<(), [closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#3}]>`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/scheduler/current_thread.rs:285:9
    |
285 |         self.enter(core, || crate::runtime::coop::budget(f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/scheduler/current_thread.rs:583:34
    |
583 |                       let (c, _) = context.run_task(core, || {
    |  __________________________________^
584 | |                         task.run();
585 | |                     });
    | |______________________^
note: inside closure
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/scheduler/current_thread.rs:615:57
    |
615 |         let (core, ret) = CURRENT.set(&self.context, || f(core, &self.context));
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::macros::scoped_tls::ScopedKey::<tokio::runtime::scheduler::current_thread::Context>::set::<[closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<[closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}], std::option::Option<()>>::{closure#0}], (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/runner/work/tokio/tokio/tokio/src/macros/scoped_tls.rs:61:9
    |
61  |         f()
    |         ^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<[closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}], std::option::Option<()>>`
   --> /home/runner/work/tokio/tokio/tokio/src/runtime/scheduler/current_thread.rs:615:27
    |
615 |         let (core, ret) = CURRENT.set(&self.context, || f(core, &self.context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `actor_weak_sender`
   --> tokio/tests/sync_mpsc_weak.rs:165:5
    |
165 |     let _ = actor_handle.await;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/sync_mpsc_weak.rs:59:30
    |
58  | #[tokio::test]
    | -------------- in this procedural macro expansion
59  | async fn actor_weak_sender() {
    |                              ^
    = note: this error originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to previous error

error: test failed, to rerun pass `--test sync_mpsc_weak`

Caused by:
  process didn't exit successfully: `/home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/bin/cargo-miri runner /home/runner/work/tokio/tokio/target/miri/x86_64-unknown-linux-gnu/debug/deps/sync_mpsc_weak-c1d4456ce3ebf68a` (exit status: 1)

--test io_read -- read_buf_bad_async_read (tokio/tests/io_read.rs:72:36, SB violation in test helper); addressed in #5322

Unsupported errors

click to show

all code calling wake() (inside mio::waker::Waker::wake):

error: unsupported operation: cannot write to event
    --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/fd.rs:152:13
     |
152  | /             libc::write(
153  | |                 self.as_raw_fd(),
154  | |                 buf.as_ptr() as *const libc::c_void,
155  | |                 cmp::min(buf.len(), READ_LIMIT),
156  | |             )
     | |_____________^ cannot write to event
     |

fs/io/time etc.: (fixed in unreleased rust-lang/miri#2764)

error: unsupported operation: can't call foreign function: epoll_wait
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.5/src/sys/unix/selector/epoll.rs:106:9
    |
106 | /         syscall!(epoll_wait(
107 | |             self.ep,
108 | |             events.as_mut_ptr(),
109 | |             events.capacity() as i32,
110 | |             timeout,
111 | |         ))
    | |__________^ can't call foreign function: epoll_wait
    |

net related:

error: unsupported operation: can't call foreign function: socket
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.5/src/sys/unix/net.rs:29:18
    |
29  |     let socket = syscall!(socket(domain, socket_type, 0));
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: socket
    |

process related:

error: unsupported operation: can't call foreign function: gnu_get_libc_version
   --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/os.rs:660:48
    |
660 |     let version_cstr = unsafe { CStr::from_ptr(gnu_get_libc_version()) };
    |                                                ^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: gnu_get_libc_version
    |
error: unsupported operation: can't call foreign function: pipe2
   --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/pipe.rs:30:21
    |
30  |                 cvt(libc::pipe2(fds.as_mut_ptr(), libc::O_CLOEXEC))?;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: pipe2
    |

signal related:

error: unsupported operation: can't call foreign function: sigaction
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/signal-hook-registry-1.4.0/src/lib.rs:214:21
    |
214 |         if unsafe { libc::sigaction(signal, ptr::null(), &mut old) } != 0 {
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: sigaction
    |

tokio/tests/net_lookup_host.rs:

error: unsupported operation: can't call foreign function: getaddrinfo
   --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/net.rs:206:25
    |
206 |                 cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: getaddrinfo
    |

tokio/tests/uds_cred.rs:

error: unsupported operation: can't call foreign function: getsockopt
   --> /home/runner/work/tokio/tokio/tokio/src/net/unix/ucred.rs:81:23
    |
81  |               let ret = getsockopt(
    |  _______________________^
82  | |                 raw_fd,
83  | |                 SOL_SOCKET,
84  | |                 SO_PEERCRED,
85  | |                 &mut ucred as *mut ucred as *mut c_void,
86  | |                 &mut ucred_size,
87  | |             );
    | |_____________^ can't call foreign function: getsockopt
    |

tempfile related (will be fixed in rust-lang/miri#2720):

error: unsupported operation: non-default mode 0o600 is not supported

@taiki-e taiki-e added the A-ci Area: The continuous integration setup label Dec 27, 2022
@taiki-e

This comment was marked as duplicate.

@taiki-e taiki-e force-pushed the taiki-e/miri branch 10 times, most recently from 3d8ceba to cd3fac9 Compare December 28, 2022 13:08
@taiki-e
Copy link
Member Author

taiki-e commented Dec 28, 2022

--lib -- runtime::time::tests::poll_process_levels (tokio/src/runtime/time/tests/mod.rs:211:26, SB violation)

This SB violation can be suppressed by calling poll_elapsed after the box move in that test, but I'm not sure what the correct fix is.

diff --git a/tokio/src/runtime/time/tests/mod.rs b/tokio/src/runtime/time/tests/mod.rs
index 88c7d768..ddd5c03d 100644
--- a/tokio/src/runtime/time/tests/mod.rs
+++ b/tokio/src/runtime/time/tests/mod.rs
@@ -215,16 +215,18 @@ fn poll_process_levels() {
     let mut entries = vec![];
 
     for i in 0..normal_or_miri(1024, 64) {
-        let mut entry = Box::pin(TimerEntry::new(
+        let entry = Box::pin(TimerEntry::new(
             &handle.inner,
             handle.inner.driver().clock().now() + Duration::from_millis(i),
         ));
 
-        let _ = entry
+        entries.push(entry);
+
+        let _ = entries
+            .last_mut()
+            .unwrap()
             .as_mut()
             .poll_elapsed(&mut Context::from_waker(noop_waker_ref()));
-
-        entries.push(entry);
     }
 
     for t in 1..normal_or_miri(1024, 64) {

```
error: unsupported operation: non-default mode 0o600 is not supported
```
```
error: unsupported operation: can't call foreign function: sigaction
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/signal-hook-registry-1.4.0/src/lib.rs:214:21
    |
214 |         if unsafe { libc::sigaction(signal, ptr::null(), &mut old) } != 0 {
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: sigaction
    |
```
```
error: unsupported operation: can't call foreign function: socket
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.5/src/sys/unix/net.rs:29:18
    |
29  |     let socket = syscall!(socket(domain, socket_type, 0));
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: socket
    |
```
```
error: unsupported operation: can't call foreign function: epoll_wait
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.5/src/sys/unix/selector/epoll.rs:106:9
    |
106 | /         syscall!(epoll_wait(
107 | |             self.ep,
108 | |             events.as_mut_ptr(),
109 | |             events.capacity() as i32,
110 | |             timeout,
111 | |         ))
    | |__________^ can't call foreign function: epoll_wait
    |
```
```
error: unsupported operation: can't call foreign function: socket
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.5/src/sys/unix/net.rs:29:18
    |
29  |     let socket = syscall!(socket(domain, socket_type, 0));
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: socket
    |
```
```
error: unsupported operation: can't call foreign function: sigaction
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/signal-hook-registry-1.4.0/src/lib.rs:214:21
    |
214 |         if unsafe { libc::sigaction(signal, ptr::null(), &mut old) } != 0 {
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: sigaction
    |
```
```
error: unsupported operation: cannot write to event
   --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/fd.rs:152:13
    |
152 | /             libc::write(
153 | |                 self.as_raw_fd(),
154 | |                 buf.as_ptr() as *const libc::c_void,
155 | |                 cmp::min(buf.len(), READ_LIMIT),
156 | |             )
    | |_____________^ cannot write to event
    |
```
```
error: unsupported operation: can't call foreign function: epoll_wait
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.5/src/sys/unix/selector/epoll.rs:106:9
    |
106 | /         syscall!(epoll_wait(
107 | |             self.ep,
108 | |             events.as_mut_ptr(),
109 | |             events.capacity() as i32,
110 | |             timeout,
111 | |         ))
    | |__________^ can't call foreign function: epoll_wait
    |
```
```
error: unsupported operation: can't call foreign function: getsockopt
   --> /home/runner/work/tokio/tokio/tokio/src/net/unix/ucred.rs:81:23
    |
81  |               let ret = getsockopt(
    |  _______________________^
82  | |                 raw_fd,
83  | |                 SOL_SOCKET,
84  | |                 SO_PEERCRED,
85  | |                 &mut ucred as *mut ucred as *mut c_void,
86  | |                 &mut ucred_size,
87  | |             );
    | |_____________^ can't call foreign function: getsockopt
    |
```
```
error: unsupported operation: cannot write to event
    --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/fd.rs:152:13
     |
152  | /             libc::write(
153  | |                 self.as_raw_fd(),
154  | |                 buf.as_ptr() as *const libc::c_void,
155  | |                 cmp::min(buf.len(), READ_LIMIT),
156  | |             )
     | |_____________^ cannot write to event
     |
```
```
error: unsupported operation: can't call foreign function: gnu_get_libc_version
   --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/os.rs:660:48
    |
660 |     let version_cstr = unsafe { CStr::from_ptr(gnu_get_libc_version()) };
    |                                                ^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: gnu_get_libc_version
    |
```
```
error: unsupported operation: can't call foreign function: pipe2
   --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/pipe.rs:30:21
    |
30  |                 cvt(libc::pipe2(fds.as_mut_ptr(), libc::O_CLOEXEC))?;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: pipe2
    |
```
```
error: unsupported operation: can't call foreign function: getaddrinfo
   --> /home/runner/.rustup/toolchains/nightly-2022-12-27-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/net.rs:206:25
    |
206 |                 cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: getaddrinfo
    |
```
```
error: unsupported operation: the 0x3 command is not supported for `fcntl`)
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.24.3/src/fcntl.rs:471:24
    |
471 |             F_GETFL => libc::fcntl(fd, libc::F_GETFL),
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the 0x3 command is not supported for `fcntl`)
    |
```
```
error: unsupported operation: integer-to-pointer casts and `ptr::from_exposed_addr` are not supported with `-Zmiri-strict-provenance`
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.9.5/src/word_lock.rs:320:9
    |
320 |         (self & QUEUE_MASK) as *const ThreadData
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ integer-to-pointer casts and `ptr::from_exposed_addr` are not supported with `-Zmiri-strict-provenance`
    |
```
@Darksonn
Copy link
Contributor

These new SB violations seem like a miri bug. Moving a box shouldn't assert uniqueness if the contents are !Unpin.

@taiki-e
Copy link
Member Author

taiki-e commented Jan 21, 2023

(blocked on rust-lang/rust#106180 that fixes a bug Darksonn mentioned)

@taiki-e taiki-e added the S-blocked Status: marked as blocked ❌ on something else such as a PR or other implementation work. label Jan 21, 2023
@Darksonn Darksonn closed this Nov 25, 2023
@Darksonn Darksonn deleted the taiki-e/miri branch November 25, 2023 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ci Area: The continuous integration setup S-blocked Status: marked as blocked ❌ on something else such as a PR or other implementation work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants